﻿$(window).resize(function () {
    $(".djack-headerPic img").height($(".djack-headerPic img").width());
})

function SetRequstDjackId() {
    $("#hidDjackId").val(GetQueryStr("djackId"));
    $(".djack-headerPic img").height($(".djack-headerPic img").width());
}
SetRequstDjackId();



function toggletags() {
    $(".menu-tags ul li").click(function () {
        var clickedClass = $(this).attr("class");
        if (clickedClass.indexOf("recommd") != -1) {
            window.location.href = "/mp_DjackRecommend.htm?djackId=" + $("#hidDjackId").val();
        }
        else if (clickedClass.indexOf("personal") != -1) {
            window.location.href = "/mp_DjackInfo.htm?djackId=" + $("#hidDjackId").val();
        }
        else if (clickedClass.indexOf("vehicleinfo") != -1) {
            window.location.href = "/mp_DjackVehicle.htm?djackId=" + $("#hidDjackId").val();
        }
    })
}
toggletags();

function SetUserBaseInfo(_data) {
    $(".djack-headerPic img").attr("src", _data.rows[0].CUSTOMER_DEFAULT_PIC + "  143x139img.jpg");
    $("#name").text(_data.rows[0].CUSTOMER_NICK);
    var gender = _data.rows[0].CUSTOMER_BASEINFO_GENDER == "F" ? "icon_gender_f.png" : "icon_gender_m.png";

    $("#icon-gender img").attr("src", "/themes/mStyle1/Image/public/" + gender);
    var serviceLables = _data.rows[0].SERVICE_LABEL.split('|');
    var serviceLableHtm = "";
    for (var i = 0; i < serviceLables.length - 1; i++) {
        switch (serviceLables[i]) {
            case "1":
                serviceLableHtm += "<span>免费旅游咨询</span>";
                break;
            case "2":
                serviceLableHtm += "<span>旅游制定</span>";
                break;
            case "3":
                serviceLableHtm += "<span>向导服务</span>";
                break;
            case "4":
                serviceLableHtm += "<span>导游服务</span>";
                break;
        }
    }
    $(".djack-servivelable").html(serviceLableHtm);
    $(".djack-show-name").text(_data.rows[0].CUSTOMER_NICK);
    $(".djack-phone").text(_data.rows[0].CUSTOMER_BASEINFO_MOBILE);
    $("#callSeller").attr("href", "tel:" + _data.rows[0].CUSTOMER_BASEINFO_MOBILE);
    $(".djack-areainfo").text(_data.rows[0].P_COUNTRY_NAME + " / " + _data.rows[0].P_CITY_NAME + " / " + _data.rows[0].P_DISTINATION_NAME)
    $(".djack-intro").html(_data.rows[0].CUSTOMER_BASEINFO_INTRO)

    $(".linkonline-text").live("click", function () {
        window.location.href = "mb_chatmessage.htm?receiveId=" + _data.rows[0].CUSTOMER_REGISTER_ID + "&receiveName=" + _data.rows[0].CUSTOMER_NICK;
    })
}